<?php
/*echo $_SERVER['HTTP_HOST'];die();
function t(&$t){
	$t = $t*2;
}
$i=2;
$r = t($i);
var_dump($i);var_dump($r);
die();*/

//print (int)pow(2,69);
//$i=11;
//printf("%d\n", printf("%d", printf("%d",$i))); 
/*$a = count ("567")  + count(null) + count(false); 

     echo $a;
echo '<br/>';echo count(false);

die();*/
echo 'This is a test ci framework file -2012-2-20';

//phpinfo();

$db = array(
'host'=>'124.172.242.12',
'uname'=>'changxiaoming',
'upwd'=>'changxiaoming@2011/*_mysql',

'db'=>'changxiaoming'
);
/*


$db = array(
'host'=>'61.191.52.211',
'uname'=>'a0525162415',
'upwd'=>'92412237',

'db'=>'a0525162415'
);

$db = array(
	'host'	=> 'localhost',
	'uname'	=> 'haawayco_jirong',
	'upwd'	=> 'haaway123',
	'database'	=> 'haawayco_jirong'

);
$conn = mysql_connect($db['host'], $db['uname'], $db['upwd']);
if(!$conn){
	die('cannot connect');
}
var_dump($conn);
mysql_select_db($db['db']);
$sql = "SELECT * 
FROM  `jr_admin` 
LIMIT 0 , 30";
$q=mysql_query($sql);

var_dump($q);
while ($r = mysql_fetch_array($q)) {
	# code...
	var_dump($r);
}

die();*/

//$sql ="
//drop table `teacher`;
//CREATE TABLE `teacher` (
//  `uid` int(11) NOT NULL,
//  `ucode` int(8) NOT NULL COMMENT '编号',
//  `name` varchar(20) NOT NULL COMMENT '联系人',
//  `subject` varchar(30) DEFAULT NULL COMMENT '主要辅导科目',
//  `fitsubject` varchar(100) DEFAULT NULL COMMENT '可教授的科目（关联科目表）',
//  `askdescribe` varchar(200) DEFAULT NULL COMMENT '要求描述',
//  `askpay` varchar(30) DEFAULT '默认标准' COMMENT '要求薪水',
//  `selfdescribe` varchar(2000) DEFAULT NULL COMMENT '自我描述',
//  PRIMARY KEY (`uid`),
//  KEY `ucode` (`ucode`) USING BTREE
//) ENGINE=InnoDB DEFAULT CHARSET=utf8;
//";
//$sql = "INSERT INTO `teacher` (`uid`, `ucode`, `name`, `subject`, `fitsubject`, `askdescribe`, `askpay`, `selfdescribe`) VALUES (2, 1331889519, '我爱小米', NULL, NULL, NULL, '默认标准', NULL);
//INSERT INTO `teacher` (`uid`, `ucode`, `name`, `subject`, `fitsubject`, `askdescribe`, `askpay`, `selfdescribe`) VALUES (4, 1331890244, '1122', NULL, NULL, NULL, '默认标准', NULL);
//INSERT INTO `teacher` (`uid`, `ucode`, `name`, `subject`, `fitsubject`, `askdescribe`, `askpay`, `selfdescribe`) VALUES (5, 1331890357, '334', NULL, NULL, NULL, '默认标准', NULL);
//INSERT INTO `teacher` (`uid`, `ucode`, `name`, `subject`, `fitsubject`, `askdescribe`, `askpay`, `selfdescribe`) VALUES (6, 1331890528, '11111', NULL, NULL, NULL, '默认标准', NULL);
//INSERT INTO `teacher` (`uid`, `ucode`, `name`, `subject`, `fitsubject`, `askdescribe`, `askpay`, `selfdescribe`) VALUES (7, 1331890567, '123111', NULL, NULL, NULL, '默认标准', NULL);
//INSERT INTO `teacher` (`uid`, `ucode`, `name`, `subject`, `fitsubject`, `askdescribe`, `askpay`, `selfdescribe`) VALUES (8, 1331890629, '2343', NULL, NULL, NULL, '默认标准', NULL);
//";
//mysql_query($sql);


$conn = mysql_connect($db['host'], $db['uname'], $db['upwd']);
if(!$conn){
	die('cannot connect');
}
var_dump($conn);
mysql_select_db($db['db']);


$sql = "select * from teacher";
$q = mysql_query($sql);
print_r($q);

while($row = mysql_fetch_array($q)){
	echo "Teacher:\t", $row['ucode'], "<br />";
}


 